package com.leostadyn.stackfarm.timestatistics.net.service;

import com.leostadyn.stackfarm.timestatistics.model.bean.AddProjectBean;
import com.leostadyn.stackfarm.timestatistics.model.bean.AddStaffBean;
import com.leostadyn.stackfarm.timestatistics.model.bean.BaseResponse;
import com.leostadyn.stackfarm.timestatistics.model.bean.DeleteBean;
import com.leostadyn.stackfarm.timestatistics.model.bean.DetailProjectBean;
import com.leostadyn.stackfarm.timestatistics.model.bean.EmployeeBean;
import com.leostadyn.stackfarm.timestatistics.model.bean.JobBean;
import com.leostadyn.stackfarm.timestatistics.model.bean.LoginBean;
import com.leostadyn.stackfarm.timestatistics.model.bean.ProjectBean;
import com.leostadyn.stackfarm.timestatistics.model.bean.StaffTimeRecordBean;
import com.leostadyn.stackfarm.timestatistics.model.bean.UpdateInfoBean;
import com.leostadyn.stackfarm.timestatistics.model.bean.UserListBean;

import java.util.HashMap;
import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;

public interface AdminService {
    //登录
    @FormUrlEncoded
    @POST("api/login")
    Observable<BaseResponse<LoginBean>> getLoginCall(@Field("userName") String account, @Field("password") String password);

    //人员工时
    @GET("api/admin/user_working_hours")
    Observable<BaseResponse<List<EmployeeBean>>> getEmployeeCall();

    //人员工时详情
    @GET("api/admin/user_working_hours/details")
    Observable<BaseResponse<List<DetailProjectBean>>> getPersonnelDetail(@Query("endDate") String end, @Query("startDate") String start, @Query("uid") String uid);

    //修改人员密码
    @FormUrlEncoded
    @POST("api/admin/user/update")
    Observable<BaseResponse<UpdateInfoBean>> setPassword(@FieldMap HashMap<String, String> data);

    //编辑人员与管理员
    @FormUrlEncoded
    @POST("api/admin/user/update")
    Observable<BaseResponse<UpdateInfoBean>> updateInfo(@FieldMap HashMap<String, String> data);

    //人员列表
    @GET("api/admin/user/list")
    Observable<BaseResponse<List<UserListBean>>> getStaffRecord(@QueryMap HashMap<String, String> data);

    //删除人员
    @FormUrlEncoded
    @POST("api/admin/user/delete")
    Observable<BaseResponse<DeleteBean>> deleteData(@FieldMap HashMap<String, String> data);

    //添加人员
    @FormUrlEncoded
    @POST("api/admin/user/add")
    Observable<BaseResponse<AddStaffBean>> addStaff(@FieldMap HashMap<String, String> data);

    //修改自己的密码
    @FormUrlEncoded
    @POST("api/common/password/modify")
    Observable<BaseResponse<UpdateInfoBean>> modifyPassword(@FieldMap HashMap<String, String> data);

    //添加项目
    @FormUrlEncoded
    @POST("api/admin/project/add_or_update")
    Observable<BaseResponse<AddProjectBean>> addProject(@FieldMap HashMap<String, String> data);

    //修改项目
    @FormUrlEncoded
    @POST("api/admin/project/add_or_update")
    Observable<BaseResponse<UpdateInfoBean>> updateProjectInfo(@FieldMap HashMap<String, String> data);

    //删除项目
    @POST("api/admin/project/delete")
    Observable<BaseResponse<DeleteBean>> deleteProject(@QueryMap HashMap<String, String> data);

    //条件查询项目
    @GET("api/common/project/query_by_conditions")
    Observable<BaseResponse<List<ProjectBean>>> getProjectRecord(@QueryMap HashMap<String, String> data);


    //根据用户获取工时详情
    @GET("api/user/timesheet/get_detail_list_by_user")
    Observable<BaseResponse<StaffTimeRecordBean>> getTimeRecord(@QueryMap HashMap<String, String> data);

    //根据条件查询得到项目工时列表
    @GET("api/admin/timesheet/get_list_conditional")
    Observable<BaseResponse<List<DetailProjectBean>>> getProjectCall(@Query("endDate") String end, @Query("beginDate") String start, @Query("status") int status);

    //根据项目获得工时详情
    @GET("api/admin/timesheet/get_detail_list_by_pro")
    Observable<BaseResponse<List<EmployeeBean>>> getProjectDetail(@Query("endDate") String end, @Query("beginDate") String start, @Query("projectId") String projectId);

    //删除一条工时记录
    @POST("api/user/timesheet/delete")
    Observable<BaseResponse<DeleteBean>> deleteTimeRecord(@QueryMap HashMap<String, String> paramer);

    //添加一条工时记录
    @FormUrlEncoded
    @POST("api/user/timesheet/add")
    Observable<BaseResponse<String>> addTimeRecord(@Field("projectId") String projectId, @Field("taskTime") float taskTime, @Field("workDate") String workDate);

    @FormUrlEncoded
    @POST("api/user/timesheet/update")
    Observable<BaseResponse<String>> updateTimeRecord(@Field("id") String timeseetId, @Field("projectId") String projectId, @Field("taskTime") float taskTime, @Field("workDate") String workDate);

    //提交记录
    @FormUrlEncoded
    @POST("api/user/timesheet/submit")
    Observable<BaseResponse<String>> submitTime(@Field("ids") String ids);

    //获取岗位列表
    @GET("api/common/posts/get_all_list")
    Observable<BaseResponse<List<JobBean>>> getJob();


}
